#!/usr/bin/perl -w

use Test::More tests => 6;

# =============================================================
# Cargamos el modulo
# ==============================================================
use_ok('Bench::Test::Local');

# =============================================================
# Comprobamos que la creacion del objeto es correcta
# =============================================================
my $local = Bench::Test::Local->new(
   EXECUTABLE => 'echo',
   WORKDIR    => '.',
);

isa_ok($local, 'Bench::Test::Local');

# =============================================================
# El comando echo es ejecutado en la maquina
# remota. La salida debe ser igual a la entrada.
# ==============================================================
my $params = "Give me five!";

ok($local->execute_preamble, 'Executing preamble');
is($local->get_result($params), "Give me five!\n", "Correct result");

# =============================================================
# Redefinimos el metodo GET_RESULT y comprobamos su
# funcionamiento
# =============================================================
$local = Bench::Test::Local->new (
   GET_RESULT => sub { return "Get result given by user"; },
   WORKDIR    => '.',
   EXECUTABLE => 'echo',
);

is($local->get_result, 'Get result given by user', 'Overwritting GET_RESULT');

# save_result

ok($local->execute_postamble, 'Executing postamble');

